package com.exploreca.tourfinder.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class FriendsDBHelper extends SQLiteOpenHelper {
	
	public static final String DB_NAME = "contacts.db";
	public static final String TABLE_NAME = "contacts";
	public static final String COLUMN_ID = "id";
	public static final String COLUMN_USERNAME = "name";
	public static final String COLUMN_PHONE = "phone";
	
	
	private static final String TABLE_CREATE = 
			"CREATE TABLE " + TABLE_NAME + " (" +
			COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT" +
			", " + COLUMN_USERNAME + " TEXT" +
			", " + COLUMN_PHONE + " TEXT" +
			")";
	
	private static int DB_VERSION = 1;

	public FriendsDBHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(TABLE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(db);
	}

}
